package com.baobao.excel.easypoi.handler;

import cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult;
import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler;
import com.baobao.excel.easypoi.bean.User;

/**
 * @author baobao
 * @create 2021-02-04 14:26
 * @description
 */
public class UserVerifyHandler implements IExcelVerifyHandler<User> {
    @Override
    public ExcelVerifyHandlerResult verifyHandler(User user) {
        // 创建校验结果
        ExcelVerifyHandlerResult result = new ExcelVerifyHandlerResult();
        // 年龄小于3校验不通过
        if (user.getAge() < 3){
            result.setSuccess(false);
            // 设置校验失败信息
            result.setMsg("年龄不能小于3");
        }else {
            result.setSuccess(true);
        }
        return result;
    }
}
